// SPDX-License-Identifier: GPL-2.0

#include <linux/types.h>

#include "inc/kernel_mapping.h"

phys_addr_t __virt_to_phys(unsigned long x)
{
    phys_addr_t pa;

    pa = x - kernel_map.va_kernel_pa_offset;

    return pa;
}

phys_addr_t linear_mapping_va_to_pa(unsigned long x)
{
    return ((unsigned long)(x) - kernel_map.va_pa_offset);
}

void* linear_mapping_pa_to_va(unsigned long x)
{
    return x + kernel_map.va_kernel_pa_offset;
}
